package com.ssyc.student.adapter;

import android.content.Context;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;

import com.ssyc.common.adapter.CommonAdapter;
import com.ssyc.common.adapter.ViewHolder;
import com.ssyc.student.R;
import com.ssyc.student.bean.ChooseAnswerInfo;

import java.util.List;

/**
 * 学生端--预习检测--展示用户选择答案的列表适配器
 * Created by Administrator on 2018/5/10 0010.
 */

public class StGvPrepareDetectionShowAnswerAdapter extends CommonAdapter<ChooseAnswerInfo> {
    private Context context;

    public StGvPrepareDetectionShowAnswerAdapter(Context context, List<ChooseAnswerInfo> datas, int layoutId) {
        super(context, datas, layoutId);
        this.context = context;
    }

    @Override
    public void convert(ViewHolder holder, ChooseAnswerInfo chooseAnswerInfo) {

        //题目标号
        TextView tv = holder.getView(R.id.tv_index);
        tv.setText(chooseAnswerInfo.getAnswerIndex() + "");

        //用户选择的答案
        TextView tvAnswer = holder.getView(R.id.tv_answer);
        if (TextUtils.isEmpty(chooseAnswerInfo.getAnswerFlag())) {
            //用户没选择答案
            tvAnswer.setVisibility(View.GONE);
        } else {
            tvAnswer.setVisibility(View.VISIBLE);
            tvAnswer.setText(chooseAnswerInfo.getAnswerFlag());
        }

    }
}
